﻿@namespace MXERP.Blazor.Components
@inherits MudBaseSelectItem
@typeparam T

@if (ComboBox is not null)
{
    <div tabindex="0" @attributes="@UserAttributes" id="@ItemId" class="@Classname" @onclick="@HandleOnClick" @onclick:stopPropagation="true" style="@Style">

        @if (ComboBox.MultiSelection && ComboBox.ShowCheckbox)
        {
            <MudCheckBox Class="me-4" Dense
                         @bind-Value="@Selected" @onclick="@HandleOnClick"
                         Size="@(CheckBoxSize ?? ComboBox.CheckBoxSize)"
                         Color="@(CheckBoxCheckedColor ?? ComboBox.EffectiveCheckBoxCheckedColor)"
                         UnCheckedColor="@(CheckBoxUnCheckedColor ?? ComboBox.EffectiveCheckBoxUnCheckedColor)"
                         Disabled="@Disabled" />
        }

        <MudText Typo="ComboBox.GetTypo()" Color="@(TextColor ?? ComboBox.TextColor)">
            @if (ChildContent != null && ComboBox.ItemPresenter == ValuePresenter.ItemContent)
            {
                @ChildContent
            }
            else
            {
                <MudHighlighter Text="@DisplayString" HighlightedText="@(ComboBox.Highlight ? ComboBox.GetSearchString() : null)" Class="@HighlighterClassname" />
            }
        </MudText>
    </div>
}
